package com.kehao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kehao.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper extends BaseMapper<Student> {

    @Select("select * from tb_user")
    List<Student> getAllStudent();

    @Select("select * from tb_user where id = #{idNum}")
    Student getOneStudent(@Param("idNum") Integer id);

    @Insert("insert into tb_user(id, username, password) values (#{id}, #{username}, #{password})")
    void addStudent(@Param("id")Integer id, @Param("username")String userName, @Param("password")String password);

    @Delete("delete from tb_user where id = #{id}")
    void del(@Param("id")Integer id);

    @Update("update tb_user set username = #{username}, password = #{password} where id = #{id}")
    void update(@Param("username")String username, @Param("password")String password, @Param("id")Integer id);
}
